x86/vmsi: tolerate unsupported MSI address/data fields
authorRoger Pau Monné <roger.pau@citrix.com>
Tue, 26 Jan 2021 16:43:27 +0000 (17:43 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 26 Jan 2021 16:43:27 +0000 (17:43 +0100)
commit07edcd17fa2dce80250b3dd31e561268bc4663a9
tree9f8b5358afb519e42f11251173eb6470a92fb80d
parent19d637617b9184ec58bad27b7756bd9ac492b005
x86/vmsi: tolerate unsupported MSI address/data fields

Plain MSI doesn't allow caching the MSI address and data fields while
the capability is enabled and not masked, hence we need to allow any
changes to those fields to update the binding of the interrupt. For
reference, the same doesn't apply to MSI-X that is allowed to cache
the data and address fields while the entry is unmasked, see section
6.8.3.5 of the PCI Local Bus Specification 3.0.

Allowing such updates means that a guest can write an invalid address
(ie: all zeros) and then a valid one, so the PIRQs shouldn't be
unmapped when the interrupt cannot be bound to the guest, since
further updates to the address or data fields can result in the
binding succeeding.

Modify the vPCI MSI arch helpers to track whether the interrupt is
bound, and make failures in vpci_msi_update not unmap the PIRQ, so
that further calls can attempt to bind the PIRQ again.

Note this requires some modifications to the MSI-X handlers, but there
shouldn't be any functional changes in that area.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/hvm/vmsi.c
xen/drivers/vpci/msi.c
xen/include/asm-x86/hvm/io.h
xen/include/xen/vpci.h